﻿using System;
using System.Collections.Generic;
using System.Text;

namespace SharedGenomics.Domain
{
    /// <summary>
    /// Represents a sample for a single marker in an individual
    /// </summary>
    [Obsolete("Data parsing should be done through the classes in SharedGenomics.Domain.Data")]
    public class GenotypeSampling
    {
        #region Constructors

        public GenotypeSampling()
        {
        }

        public GenotypeSampling(string allele1, string allele2)
        {
            this.Allele1 = allele1;
            this.Allele2 = allele2;
        }

        #endregion

        #region Public Methods

        public override bool Equals(object obj)
        {
            GenotypeSampling comp = obj as GenotypeSampling;

            if (comp == null)
                return false;
            else
                return  String.Equals(this.Allele1, comp.Allele1) &&
                        String.Equals(this.Allele2, comp.Allele2);
        }

        public override int GetHashCode()
        {
            int allele1HashCode = this.Allele1 == null ? 1 : this.Allele1.GetHashCode();
            int allele2HashCode = this.Allele2 == null ? 1 : this.Allele2.GetHashCode();

            return (allele1HashCode * allele2HashCode) % Int32.MaxValue;
        }

        #endregion

        #region Properties

        public string Allele1 { get; set; }
        public string Allele2 { get; set; }

        public bool IsMissing
        {
            get
            {
                return (String.IsNullOrEmpty(this.Allele1) || String.IsNullOrEmpty(this.Allele2));
            }
        }

        #endregion
    }
}
